package com.ruoyi.system.api.factory;

import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteSysMenuService;
import com.ruoyi.system.api.domain.SysMenu;

/**
 * 菜单权限微服务降级处理
 * 
 * @author ruoyi
 * @date 2023-04-27
 */
@Component
public class RemoteSysMenuFallbackFactory implements FallbackFactory<RemoteSysMenuService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSysMenuFallbackFactory.class);

    @Override
    public RemoteSysMenuService create(Throwable throwable)
    {
        log.error("菜单权限服务调用失败:" + throwable.getMessage(), throwable);
        return new RemoteSysMenuService()
        {
            @Override
            public R<SysMenu> selectSysMenuByMenuId(Long menuId, String source) {
                return null;
            }

            @Override
            public R<List<SysMenu>> selectSysMenuList(SysMenu sysMenu, String source) {
                return null;
            }

            @Override
            public R<Integer> insertSysMenu(SysMenu sysMenu, String source) {
                return null;
            }

            @Override
            public R<Integer> updateSysMenu(SysMenu sysMenu, String source) {
                return null;
            }

            @Override
            public R<Integer> deleteSysMenuByMenuIds(Long[] menuIds, String source) {
                return null;
            }
        };

    }
}
